<!DOCTYPE html>
<html>
    <head>

    </head>
    <body>
        <script>
            console.log(a);
            var a=10;
            console.log(a);
            function foo(){
                console.log("foo() a="+a);
                var a=20;
                console.log("foo() a="+a);
            }
            foo();
            console.log("a="+a);
        </script>
    </body>
</html>